<?php include('header.php'); ?>
<script type="text/javascript" src="<?php echo $base_url ?>../js/jquery-ui-1.8.16.custom.min.js"></script>
<link type="text/css" href="<?php echo $base_url.$application; ?>/themes/<?php echo $theme; ?>/skins/<?php echo $skin; ?>/css/blitzer/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<link type="text/css" href="<?php echo $base_url ?>../js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo $base_url ?>../js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js"></script>


<script type="text/javascript">
    function validate() {
        document.campaign.submit();
    }
    
    function goBack() {
        window.location.href = "<?php echo $back; ?>";
    }
    
    $(document).ready(function() {
        $('#start_date').datetimepicker({
            dateFormat: "dd/mm/yy",
            stepMinute: 5
        });

        var steps = new Array(
        <?php 
            if ($prices_list->fetchFirst()) {
                echo $prices_list->target;
            }
            
            while($prices_list->fetchNext()) {
                echo ",$prices_list->target";
            } ?>
        );
        
        var currentStep = 1;
        
        for(var i = 0; i < 6; i++) {
            if (steps[i] == <?php echo $campaign->click_target ? $campaign->click_target : '100'; ?>) {
                currentStep = i;
                break;
            }
        }

        $( "#target-slider" ).slider({
			value: currentStep,
			min: 0,
			max: <?php echo $prices_list->countRows() - 1; ?>,
			step: 1,
			slide: function( event, ui ) {
				$( "#target" ).val( steps[ui.value] );
			}
		});
		$( "#target" ).val( steps[$( "#target-slider" ).slider( "value" )] );
    });
    
</script>
    <!-- Right Side/Main Content Start -->
    <div id="rightside">
        <?php include('notification_bar.php'); ?>
        <!-- Alternative Content Box Start -->
         <div class="contentcontainer med left">
            <div class="headings altheading">
                <h2>Your Campaigns</h2>
            </div>
            <div class="contentbox">
            	<form action="" method="post" name="campaign">
                    <input type="hidden" id="act" name="act" value="<?php echo ACT_SUBMIT; ?>"/>
                    <p>
                        <label for="url"><strong>Your Facebook fan page:</strong></label>
                        <input type="text" id="url" class="inputbox" id="url" name="url" value="<?php echo $campaign->url; ?>" /> <br />
                        <span class="smltxt">(Please copy URL of your Facebook fan page and place here)</span>
                    </p>
                    
                    <div>
                        <label><strong>Likes target / Price:</strong></label>
                    <table id="slider-target">
                        <tr>
                            <?php if ($prices_list->fetchFirst())
                                echo "<td>".number_format($prices_list->target)." / ".(is_numeric($prices_list->price_display) ? "$".number_format($prices_list->price_display) : "FREE")."</td>"; 
                            ?>
                            <?php while ($prices_list->fetchNext()) { 
                                echo "<td>".number_format($prices_list->target)." / ".(is_numeric($prices_list->price_display) ? "$".number_format($prices_list->price_display) : "FREE")."</td>";
                            } ?>
                        </tr>
                        <tr>
                            <td colspan="<?php echo $prices_list->countRows(); ?>" style="padding:0 8%;">
                                <div id="target-slider" style="background:#F6F6F6;"></div>
                            </td>
                        </tr>
                    </table>
                    <input id="target" name="target" type="hidden" value="<?php echo $campaign->click_target; ?>" />
                    </div>
                    <p>
                        <label for="country"><strong>Applied for countries:</strong></label>
                        <select class="inputbox" id="country" name="country[]" multiple="multiple" size="10">
                            <?php $region_name = ''; ?>
                            <?php while($country->fetchNext()) { ?>
                            
                            <?php
                                if ($country->region_name != $region_name) {
                                    if ($region_name != '')
                                        echo '</optgroup>';
                                    echo '<optgroup label="'.$country->region_name.'">';
                                    $region_name = $country->region_name;
                                }
                            ?>
                            <option <?php if ($country->selected > 0) { echo 'selected'; } ?> 
                                value="<?php echo $country->code; ?>"><?php echo $country->name; ?></option>
                            <?php } ?>
                            <?php echo '</optgroup>'; ?>
                        </select>
                        <br>
                        <span class="smltxt">(Hold Ctrl key to choose more countries)</span>
                    </p>
                    <p>
                        <label for="start_date"><strong>Will be started on:</strong></label>
                        <input id="start_date" class="inputbox smallbox" style="text-align:center;" name="start_date" value="<?php echo $campaign->start_date; ?>" />
                        <br>
                        <span class="smltxt">(Date format: Day / Month / Year&nbsp;&nbsp;Hour : Minute : Second)</span>
                    </p>
                    
      
                </form>
                <div class="right">
                    <input id="btnSubmit" type="submit" value="Submit" class="btn" onclick="validate()" />&nbsp;<input id="btnReturn" type="button" value="Go back" class="btnalt" onclick="goBack()" />
                </div>
                
                <div style="clear: both;"></div>
            </div>
            
        </div>
        
        <div class="contentcontainer sml right" >
            <div class="headings altheading">
                <h2>Tips</h2>
            </div>
            <div class="contentbox">
            	<h2 style="margin-bottom: 15px;">Some styling examples below:</h2>
                <p><strong>List style one</strong></p>
                <ul class="list">
                	<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>
                    <li>Consectetuer adipiscing elit</li>
                    <li>Sed diam nonummy nibh euismod tincidunt</li>
                </ul>
                <div class="spacer"></div>
                <p><strong>List style two</strong></p>
                <ul class="ticklist">
                	<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</li>
                    <li class="cross">Consectetuer adipiscing elit</li>
                    <li>Sed diam nonummy nibh euismod tincidunt</li>
                </ul>
                
                <p>Lorem ipsum dolor sit amet, <span class="highlighted">highlighted</span>, sed diam nonummy nibh euismod tincidunt.</p>
                
                <p>Faded spacer example:</p>
                <div class="spacer"></div>
                
                <p><span class="dropcap">D</span>rop cap example to make your text stand out more! Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt.</p>
                 <div class="spacer"></div>
                <h1> Heading 1 example</h1>
                <div class="spacer"></div>
                <h2>Heading 2 example</h2>
                <div class="spacer"></div>
                <h3>Heading 3 example</h3>
                <div class="spacer"></div>
                <h4>Heading 4 example</h4>
                <div class="spacer"></div>
                <h5>Heading 5 example</h5>
            </div>
             
        </div>
        
        <div style="clear:both;"></div>

        <!-- Content Box End -->
        
<?php include('footer.php'); ?>